// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

const db = cloud.database()

// 云函数入口函数
exports.main = async (event, context) => {
    const wxContext = cloud.getWXContext()
    // let resultList = db.collection('plantsMarks').get()

    return await db.collection('plantsMarks').aggregate()
    .lookup({
        from: 'plants',
        localField: 'plant',
        foreignField: '_id',
        as: 'plant',
    }).limit(5000)
    .end()
    // .then(res => {
    //     return   res
    // })
    // .catch(err => {
    //     return   err
    // })
    
    // return await db.collection('plantsMarks').get()
}